package com.iwhalecloud.bss.kite.cucc.web.service.accept.handler.module;

import com.iwhalecloud.bss.kite.client.vo.scene.CommonAttrModuleVO;
import com.iwhalecloud.bss.kite.client.vo.spec.ServiceOfferVO;
import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.web.service.accept.util.CommonInfoUtils;
import com.iwhalecloud.bss.kite.manager.api.IQuerySceneInstService;
import com.iwhalecloud.bss.kite.web.service.accept.bo.AcceptContext;
import com.iwhalecloud.bss.kite.web.service.accept.bo.SceneModule;
import com.iwhalecloud.bss.kite.web.service.accept.handler.module.CommonAttrModuleHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Service
public class CustManagerInfoModuleHandler extends CommonAttrModuleHandler {

    @Autowired
    private IQuerySceneInstService querySceneInstService;

    @Override
    public CommonAttrModuleVO dealExecuteSpecialAttr(AcceptContext context, SceneModule sceneModule, CommonAttrModuleVO defCommonAttrInfoVO) {
        // 物联网运营类变更除经办人信息外的公共信息置灰
        ServiceOfferVO serviceOfferVO = CommonInfoUtils.getServiceOfferVO(context.getAcceptRequest().getSceneInstId(), context.getAcceptRequest().getCustId(), context.getAcceptRequest().getOfferId());
        if (Objects.nonNull(serviceOfferVO) && KeyConsts.INTERNET_THINGS_BUSINESS.equals(serviceOfferVO.getOperateType())
            && KiteStringUtils.equalsAny(sceneModule.getKiteModule().getLayoutPage(), "CustManagerInfo")) {
            defCommonAttrInfoVO.setIsEdit("F");
        }
        return defCommonAttrInfoVO;
    }

    @Override
    public CommonAttrModuleVO dealPreviewSpecialAttr(AcceptContext context, SceneModule sceneModule, CommonAttrModuleVO defCommonAttrInfoVO) {
        return defCommonAttrInfoVO;
    }

}
